In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Psst... Ruszyły zawody olimpiady informatycznej dla uczniów szkół podstawowych i średnich. Zadania na tych konkursach są bardzo podobne do zadań, które rozwiązujesz, tutaj, na Szkopule. Zobacz więcej:
- dla uczniów szkół podstawowych: oij.edu.pl/start/
- dla uczniów szkół średnich: oi.edu.pl/l/jak_zaczac/
Consider an integer sequence .
A (strictly) increasing sequence of indices , where ,
is called declining if .
A sequence of indices is lexicographically smaller
od than a sequence of indices if for some
it holds that for each and .
Your task is to answer several queries of the form: find the (lexicographically) -th smallest
declining sequence of indices.
Input
The first line of the standard input contains three integers , and
(, ) that denote the length of the sequence ,
the length of the considered declining sequences and the number of queries.
The second line contains integers ().
The following lines contain descriptions of the queries: the -th of these lines
contains a single integer ().
Output
Your program should write lines to the standard output.
The -th line should contain the -th smallest declining sequence of indices
or a single number if the requested declining sequence does not exist.
Example
For the input data:
5 3 3
-1 6 5 2 1
1
5
3
the correct result is:
2 3 4
-1
2 4 5
Explanation of the example: The declining sequences of indices of length 3
in this example are, in the lexicographical order, as follows:
, , and .